<template>
<div>
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
    <!-- t头部搜索框 -->
    <van-sticky>
        <div class="header">
            <van-search placeholder="搜索我的收藏" v-model="value" style="width:80%;margin: 0 auto;"/>
        </div>
    </van-sticky>
    <!-- end头部搜索框 -->
    <!-- 导航栏 -->
    <div class="nav">
        <van-tabs v-model="active">
            <van-tab title="标签 1">
                <div  class="t1">
                    <router-link to="/">
                    <div class="sp" v-for="a in nav" :key="a">
                        <h1 v-bind:style="{'background-image':'url('+ a.bgimg +')'}"></h1>
                        <div class="t2">
                            <h2>{{ a.h2 }}</h2>
                            <h3>{{ a.h3 }}</h3>
                            <h4>{{ a.h4 }}</h4>
                        </div>
                    </div>
                    </router-link>
                </div>
            </van-tab>
            <van-tab title="标签 2">没啥了</van-tab>
            <van-tab title="标签 3">内容 3</van-tab>
</van-tabs>
    </div>
    <!-- end导航栏 -->
</van-pull-refresh>
<!-- 底部标签栏 -->
     <van-tabbar
  v-model="active1"
  active-color="#07c160"
  inactive-color="#000"
  >
  <van-tabbar-item name="cf" icon="wap-home" to="/">下厨房</van-tabbar-item>
  <van-tabbar-item name="sj" icon="shop-collect" to="/shiji">市集</van-tabbar-item>
  <van-tabbar-item name="sc" icon="like" to="/shoucang">收藏</van-tabbar-item>
  <van-tabbar-item name="xj" icon="invition" to="/xj">信籍</van-tabbar-item>
  <van-tabbar-item name="me" icon="manager" to="/wo">我</van-tabbar-item>
</van-tabbar>
    <!-- end底部标签栏 -->
</div>
</template>
<script>
export default {
    data () {
        return {
            count: 0,
            isLoading: false,
            active: 0,
            nav: '',
            active1: 'sc'
        };
    },
    created: function () {
        const api = '/shoucang.json';
        this.axios.get(api).then((response) => {
            this.nav = response.data.nav;
        });
    },
    methods: {
        onRefresh () {
            setTimeout(() => {
                this.$toast('刷新成功');
                this.isLoading = false;
                this.count++;
            }, 500);
        }
    },
    components: {}
};
</script>
<style lang="less">
*{
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
    outline: none;
    box-sizing: border-box;
}
.header{
    width: 100%;
    height: 44px;
    background-color: #fff;
}
.t1{
    width: 100%;
    min-height: 800px;
    padding-top: 20px;
    .sp{
        width: 90%;
        margin: 0 auto;
        height: 110px;
        margin-bottom: 20px;
        h1{
            width: 40%;
            height: 100%;
            background-size: 100% 100%;
            float: left;
        }
        .t2{
            width: 60%;
            height: 100%;
            float: left;
            padding-left: 5%;
            h2{
                width: 100%;
                height: 35px;
                color: rgba(80, 80, 80, 1);
                font-size: 16px;
                text-align: left;
                line-height: 35px;
                margin-bottom: 5px;
                margin-top: 6px;
            }
            h3{
                width: 100%;
                height: 26px;
                font-size: 12px;
                color: rgba(166, 166, 166, 1);
                text-align: left;
                line-height: 26px;
            }
            h4{
                width: 100%;
                height: 23px;
                color: rgba(56, 56, 56, 1);
                font-size: 12px;
                text-align: left;
                line-height: 23px;
            }
        }
    }
}
</style>
